﻿using Smobiler.Core;
using Smobiler.Core.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model;
using FubiManger.Controls;
using DAL;

namespace FubiManger.UI
{
    partial class EditdiskForm : Smobiler.Core.Controls.MobileForm
    {
        public EditdiskForm() : base()
        {
            //This call is required by the SmobilerForm.
            InitializeComponent();
        }
        /// <summary>
        /// 商户ID
        /// </summary>
        public string merchantid { get; set; }
        /// <summary>
        /// 餐桌集合
        /// </summary>
        List<ms_disk> disklist = new List<ms_disk>();
        private void panclose_Press(object sender, EventArgs e)
        {
            this.Close();
        }

        private void EditdiskForm_Load(object sender, EventArgs e)
        {
            Refsh();
        }
        /// <summary>
        /// 添加餐桌信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void panadd_Press(object sender, EventArgs e)
        {
            Adddiskcontrol con = new Adddiskcontrol();
            con.merchantid = merchantid;//商户ID
            this.Form.ShowDialog(con);
        }
        /// <summary>
        /// 刷新
        /// </summary>
        public void Refsh()
        {
            if (pandisk.Controls.Count > 0)
                pandisk.Controls.Clear();
            disklist = diskDal.Querybymerid(merchantid);
            pandisk.Height = disklist.Count * 48;
            pandisks.Height = pandisk.Height + 64;
            for (int i = 0; i < disklist.Count; i++)
            {
                diskcontrol con = new diskcontrol();
                con.diskname = disklist[i].ds_disknmae;
                con.diskperson = disklist[i].ds_person;
                con.diskid = disklist[i].ds_id;//编号
                con.merchantid = merchantid;//商户号
                pandisk.Controls.Add(con);
            }
        }
    }
}